package test4_10.demo01;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Homework21_6 {

    public static void copy() throws Exception {

        FileOutputStream fos = new FileOutputStream("D://a/bbb.txt");
        FileInputStream fis = new FileInputStream("D://aaa.txt");

        byte[] byteBuffer = new byte[1024*8];

        int length = 0;
        while ((length = fis.read(byteBuffer))!=-1){
            fos.write(byteBuffer,0,length);
            fos.flush();
        }

        fis.close();
        fos.close();
    }

    public static void main(String[] args) throws Exception {
        Homework21_6.copy();
    }

}
